package com.dashu.device.service;

import com.dashu.base.utils.CopyUtil;
import com.dashu.device.dto.attendance.AttendanceDateDTO;
import com.dashu.device.model.AttendanceDate;
import com.dashu.device.model.QAttendanceDate;
import com.querydsl.core.BooleanBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;


@Slf4j
@Service
public class AttendanceDateService extends DataService {

    public List<AttendanceDate> findAttendanceGroup(long attendanceRuleId) {
        QAttendanceDate qAttendanceDate = QAttendanceDate.attendanceDate;
        BooleanBuilder booleanBuilder = new BooleanBuilder();
        booleanBuilder.and(qAttendanceDate.ruleId.eq(attendanceRuleId));
        List<AttendanceDate> attendanceDates =
                queryFactory
                        .select(qAttendanceDate)
                        .from(qAttendanceDate)
                        .where(booleanBuilder.getValue())
                        .fetch();
        return attendanceDates;

    }
}
